package cn.iocoder.yudao.module.ai.dal.mysql.creationwork;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ai.dal.dataobject.creationwork.CreationWorkDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ai.controller.admin.creationwork.vo.*;

/**
 * AI 创作作品 Mapper
 *
 * @author zhaokang
 */
@Mapper
public interface CreationWorkMapper extends BaseMapperX<CreationWorkDO> {

    default PageResult<CreationWorkDO> selectPage(CreationWorkPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CreationWorkDO>()
                .eqIfPresent(CreationWorkDO::getUserId, reqVO.getUserId())
                .eqIfPresent(CreationWorkDO::getAiCreationModelId, reqVO.getAiCreationModelId())
                .eqIfPresent(CreationWorkDO::getPlatform, reqVO.getPlatform())
                .eqIfPresent(CreationWorkDO::getModel, reqVO.getModel())
                .eqIfPresent(CreationWorkDO::getPrompt, reqVO.getPrompt())
                .eqIfPresent(CreationWorkDO::getGeneratedContent, reqVO.getGeneratedContent())
                .betweenIfPresent(CreationWorkDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CreationWorkDO::getId));
    }

}